<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>v-model结合checkbox使用</title>
  </head>
  <body>
    <div id="app">
      <!-- 1.checkbox的单选框 -->
      <label for="agree">
        <input type="checkbox" id="agree" v-model="isAgree" />同意协议
      </label>
      <h2>您选择的是：{{isAgree}}</h2>
      <button :disabled="!isAgree">下一步</button>
      <!-- 2.CheckBox的多选框 -->
      <br />
      <label for="">
        <input type="checkbox" value="轮滑" v-model="hobby" />轮滑
        <input type="checkbox" value="跑步" v-model="hobby" />跑步
        <input type="checkbox" value="代码" v-model="hobby" />代码
        <input type="checkbox" value="键盘" v-model="hobby" />键盘
      </label>
      <h4>您的爱好是：{{hobby}}</h4>
    </div>
    <script src="../vue.js"></script>
    <script>
      const app = new Vue({
        el: "#app",
        data: {
          message: "hello",
          isAgree: false, //单选框
          hobby: [], //多选框
        },
      });
    </script>
  </body>
</html>
